//
//  QWeiboClient.h
//  huipai_3
//
//  Created by tan xi on 11-9-6.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "QWeiboAsyncApi.h"

enum  {
    QWeiboStateNone     = 0,
    QWeiboStateUserInfo = 1,
    QWeiboStateUpload   = 2
};

typedef int QWeiboState;

@protocol QWeiboClientDelegate;

@interface QWeiboClient : NSObject {
    id<QWeiboClientDelegate>  delegate;
    NSString    *appKey,
                *appSecret,
                *tokenKey,
                *tokenSecret,
                *weiboIndentify;
    NSMutableData   *responseData;
    NSURLConnection *connection;
    QWeiboState state;
}

- (id)initWithAppKey:(NSString*)appKey 
           appSecret:(NSString*)appSecret
            tokenKey:(NSString*)tokenKey
         tokenSecret:(NSString*)tokenSecret;
- (void)getUserInfo;
- (void)saveQAccessToken:(NSString*)email;
- (void)getSourceAccessToken:(NSString*)email;
+ (void)delectThisToken:(NSString*)email;
+ (BOOL)isExit:(NSString*)email;
- (void)upload:(NSString*)text image:(NSData*)data;
- (void)upload:(NSString*)text imagePath:(NSString*)path;

@property (nonatomic, retain) id<QWeiboClientDelegate>  delegate;
@property (nonatomic, retain) NSString  *appKey, *appSecret,
                                        *tokenKey, *tokenSecret,
                                        *weiboIndentify;

@end


@protocol QWeiboClientDelegate <NSObject>

- (void)QUserInfo:(QWeiboClient*)sender dic:(NSDictionary*)dic;
- (void)QUploadOver:(NSError*)error;

@end